package cn.edu.bupt.freewings.forum.server.rest;

import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import org.apache.log4j.Logger;
import cn.edu.bupt.freewings.forum.common.TopicType;
import cn.edu.bupt.freewings.forum.persistence.Topic;
import cn.edu.bupt.freewings.forum.persistence.TopicDAO;
import cn.edu.bupt.freewings.forum.server.Utility.Converter;

/**
 * @author hubaiyu (hubaiyu@gmail.com)
 *
 */

@Path("/topics")
public class TopicsResource {
	
	private static Logger logger = Logger.getLogger(TopicsResource.class);
	
	@GET
	@Path("/{projectId}")
	@Produces({"application/proto", "application/xml"})
	public TopicType.TopicList getTopicListByProjectId(@PathParam("projectId") Integer projectId){
		List<Topic> topicList = new TopicDAO().getByProjectId(projectId);
		return Converter.topicListTpTopicTypeList(topicList, projectId);
	}
	
}
